/*
 * Copyright (C) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.sermant.dubbo.registry.service.nacos;

import io.sermant.core.plugin.service.PluginService;

import java.util.Map;

/**
 * NACOS Registration Service
 *
 * @author chengyouling
 * @since 2022-10-25
 */
public interface NacosRegistryService extends PluginService {
    /**
     * Register instance
     *
     * @param url url
     * @see com.alibaba.dubbo.common.URL
     * @see org.apache.dubbo.common.URL
     */
    void doRegister(Object url);

    /**
     * Subscription API
     *
     * @param notifyListener instance notifies the listener
     * @param url url
     * @see com.alibaba.dubbo.common.URL
     * @see org.apache.dubbo.common.URL
     * @see com.alibaba.dubbo.registry.NotifyListener
     * @see org.apache.dubbo.registry.NotifyListener
     */
    void doSubscribe(Object url, Object notifyListener);

    /**
     * Clear the instance
     *
     * @param url url
     * @see com.alibaba.dubbo.common.URL
     * @see org.apache.dubbo.common.URL
     */
    void doUnregister(Object url);

    /**
     * Build a naming service
     *
     * @param parameters URL parameters
     */
    void buildNamingService(Map<String, String> parameters);

    /**
     * Clear the subscription
     *
     * @param notifyListener Listening
     * @param url url
     * @see com.alibaba.dubbo.common.URL
     * @see org.apache.dubbo.common.URL
     * @see com.alibaba.dubbo.registry.NotifyListener
     * @see org.apache.dubbo.registry.NotifyListener
     */
    void doUnsubscribe(Object url, Object notifyListener);

    /**
     * Is NamingService available?
     *
     * @return Whether the service is available
     */
    boolean isAvailable();
}
